<!DOCTYPE html>
<html>
<head>
    

    

    
<!-- Baidu Tongji -->
<script>var _hmt = _hmt || []</script>
<script async src="//hm.baidu.com/hm.js?ca9f046e770c921a4fd9535af2bb011a"></script>
<!-- End Baidu Tongji -->




    <meta charset="utf-8">
    
    
    
    <link rel="canonical" href="true/weblog/2018/09/30/webSocket/">
    
    
    <title>node WebSocket通信 | Greg&#39;s Blog | 今天也要加油鸭.jpg</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="node.js">
    <meta name="description" content="使用nodejs-websocket模块部署WebSocket Server；使用websocket模块部署WebSocket Client；WebSocket Client请求连接WebSocket Server，配置有心跳机制和重连机制，保证WebSocket长时间保持通信。">
<meta name="keywords" content="node.js">
<meta property="og:type" content="article">
<meta property="og:title" content="node WebSocket通信">
<meta property="og:url" content="https://greg0566.gitee.io/weblog/2018/09/30/webSocket/index.html">
<meta property="og:site_name" content="Greg&#39;s Blog">
<meta property="og:description" content="使用nodejs-websocket模块部署WebSocket Server；使用websocket模块部署WebSocket Client；WebSocket Client请求连接WebSocket Server，配置有心跳机制和重连机制，保证WebSocket长时间保持通信。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2018-09-29T16:09:11.921Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="node WebSocket通信">
<meta name="twitter:description" content="使用nodejs-websocket模块部署WebSocket Server；使用websocket模块部署WebSocket Client；WebSocket Client请求连接WebSocket Server，配置有心跳机制和重连机制，保证WebSocket长时间保持通信。">
    
        <link rel="alternate" type="application/atom+xml" title="Greg&#39;s Blog" href="/weblog/atom.xml">
    
    <link rel="shortcut icon" href="/weblog/duck.png">
    <link rel="stylesheet" href="/weblog/css/style.css?v=1.7.2">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/weblog/img/brand.jpg)">
      <div class="brand">
        <a href="/weblog/" class="avatar waves-effect waves-circle waves-light">
          <img src="/weblog/img/head.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Greg Zhou</h5>
          <a href="mailto:zhourikai@imperial-vision.com" title="zhourikai@imperial-vision.com" class="mail">zhourikai@imperial-vision.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/weblog/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/weblog/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                编年史
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/weblog/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/zhourikai2008" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://wuyukangkang.gitee.io/blog" target="_blank" >
                <i class="icon icon-lg icon-location-arrow"></i>
                友情链接 - 康康大神
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">node WebSocket通信</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">node WebSocket通信</h1>
        <h5 class="subtitle">
            
                <time datetime="2018-09-29T16:09:11.920Z" itemprop="datePublished" class="page-time">
  2018-09-30
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#WebSocket-Server"><span class="post-toc-number">1.</span> <span class="post-toc-text">WebSocket Server</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#WebSocket-Client"><span class="post-toc-number">2.</span> <span class="post-toc-text">WebSocket Client</span></a></li></ol>
        </nav>
    </aside>


<article id="post-webSocket"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">node WebSocket通信</h1>
        <div class="post-meta">
            <time class="post-time" title="2018-09-30 00:09:11" datetime="2018-09-29T16:09:11.920Z"  itemprop="datePublished">2018-09-30</time>

            


            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <p>使用<strong>nodejs-websocket</strong>模块部署WebSocket Server；使用<strong>websocket</strong>模块部署WebSocket Client；WebSocket Client请求连接WebSocket Server，配置有心跳机制和重连机制，保证WebSocket长时间保持通信。</p>
<a id="more"></a>
<h1 id="WebSocket-Server"><a href="#WebSocket-Server" class="headerlink" title="WebSocket Server"></a>WebSocket Server</h1><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> ws = <span class="built_in">require</span>(<span class="string">'nodejs-websocket'</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// WebSocket Server</span></span><br><span class="line">ws.createServer(<span class="function"><span class="keyword">function</span>(<span class="params">conn</span>)</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'WebSocket Client Connected.'</span>);</span><br><span class="line"></span><br><span class="line">    conn.on(<span class="string">'text'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">str</span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Client Connection check'</span>);</span><br><span class="line">        conn.sendText(str);</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    conn.on(<span class="string">'close'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">code, reason</span>)</span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Client Connection closed.'</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//断开连接时操作，如邮件通知</span></span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    conn.on(<span class="string">'error'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">err</span>)</span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Client Handle Err: '</span>);</span><br><span class="line">        <span class="built_in">console</span>.log(err)</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;).listen(<span class="number">3001</span>);</span><br></pre></td></tr></table></figure>
<h1 id="WebSocket-Client"><a href="#WebSocket-Client" class="headerlink" title="WebSocket Client"></a>WebSocket Client</h1><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> WebSocketClient = <span class="built_in">require</span>(<span class="string">'websocket'</span>).client;</span><br><span class="line"></span><br><span class="line"><span class="comment">// WebSocket Client</span></span><br><span class="line"><span class="keyword">var</span> WebSocketServerHost = <span class="string">'ws://localhost:3001/'</span>;</span><br><span class="line"><span class="keyword">var</span> WebSocketClient = <span class="keyword">new</span> WebSocketClient();</span><br><span class="line">WebSocketClient.on(<span class="string">'connectFailed'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">error</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'Connect Failed: '</span> + error.toString());</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 重连机制。连接失败时，两分钟后请求重连</span></span><br><span class="line">    setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'Reconnect to WebSocket Server: '</span>);</span><br><span class="line">        WebSocketClient.connect(WebSocketServerHost);</span><br><span class="line">    &#125;, <span class="number">2</span> * <span class="number">60</span> * <span class="number">1000</span>);</span><br><span class="line">&#125;);</span><br><span class="line">WebSocketClient.on(<span class="string">'connect'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">connection</span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connected'</span>);</span><br><span class="line"></span><br><span class="line">    connection.on(<span class="string">'error'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">error</span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connection Error: '</span>);</span><br><span class="line">        <span class="built_in">console</span>.log(error);</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 重连机制。连接断开时，两分钟后请求重连</span></span><br><span class="line">    connection.on(<span class="string">'close'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connection Closed'</span>);</span><br><span class="line"></span><br><span class="line">        setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">'Reconnect to WebSocket Server: '</span>);</span><br><span class="line">            WebSocketClient.connect(WebSocketServerHost);</span><br><span class="line">        &#125;, <span class="number">2</span> * <span class="number">60</span> * <span class="number">1000</span>);</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    connection.on(<span class="string">'message'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">message</span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connection alive.'</span>);</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 心跳机制。每两分钟发送一次数据，保持通信。</span></span><br><span class="line">    <span class="keyword">if</span> (connection.connected) &#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connection check'</span>);</span><br><span class="line">        connection.sendUTF(<span class="string">'hello'</span>);</span><br><span class="line">    &#125;</span><br><span class="line">    setInterval(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (connection.connected) &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">'WebSocket Server Connection check'</span>);</span><br><span class="line">            connection.sendUTF(<span class="string">'hello'</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;, <span class="number">2</span> * <span class="number">60</span> * <span class="number">1000</span>);</span><br><span class="line">&#125;);</span><br><span class="line">WebSocketClient.connect(WebSocketServerHost);</span><br></pre></td></tr></table></figure>
        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2018-09-29T16:09:11.921Z" itemprop="dateUpdated">2018-09-30 00:09:11</time>
</span><br>


        
        原始链接：<a href="/weblog/2018/09/30/webSocket/" target="_blank" rel="external">https://greg0566.gitee.io/weblog/2018/09/30/webSocket/</a>
        
    </div>
    
    <footer>
        <a href="https://greg0566.gitee.io/weblog">
            <img src="/weblog/img/head.jpg" alt="Greg Zhou">
            Greg Zhou
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/weblog/tags/node-js/">node.js</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&title=《node WebSocket通信》 — Greg's Blog&pic=https://greg0566.gitee.io/weblog/img/head.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&title=《node WebSocket通信》 — Greg's Blog&source=使用nodejs-websocket模块部署WebSocket Server；使用websocket模块部署WebSocket Client；WebSoc..." data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《node WebSocket通信》 — Greg's Blog&url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&via=https://greg0566.gitee.io/weblog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/weblog/2018/09/30/test/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">测试</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/weblog/2018/09/29/ImageResizer/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">前端JS 图片压缩</h4>
      </a>
    </div>
  
</nav>



    











    <!-- Valine Comments -->
    <div class="comments vcomment" id="comments"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
    <!-- Valine Comments script -->
    <script>
        var GUEST_INFO = ['nick','mail','link'];
        var guest_info = 'nick,mail'.split(',').filter(function(item){
          return GUEST_INFO.indexOf(item) > -1
        });
        new Valine({
            el: '#comments',
            notify: 'false' == 'true',
            verify: 'true' == 'true',
            appId: "8LYR57meeLmJoqq4dEX8OGyj-gzGzoHsz",
            appKey: "6GCR491vuixHmMep2r9xFrOc",
            avatar: "mm",
            placeholder: "说点什么吧~",
            guest_info: guest_info.length == 0 ? GUEST_INFO : guest_info,
            pageSize: "10"
        })
    </script>
    <!-- Valine Comments end -->







</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢大爷~
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/weblog/img/wechat.png" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/weblog/img/wechat.png" data-alipay="/weblog/img/alipay.png">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/weblog/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>Greg Zhou &copy; 2018</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&title=《node WebSocket通信》 — Greg's Blog&pic=https://greg0566.gitee.io/weblog/img/head.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&title=《node WebSocket通信》 — Greg's Blog&source=使用nodejs-websocket模块部署WebSocket Server；使用websocket模块部署WebSocket Client；WebSoc..." data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《node WebSocket通信》 — Greg's Blog&url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/&via=https://greg0566.gitee.io/weblog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://greg0566.gitee.io/weblog/2018/09/30/webSocket/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/weblog/', SHARE: true, REWARD: true };


</script>

<script src="/weblog/js/main.min.js?v=1.7.2"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="/weblog/js/search.min.js?v=1.7.2" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
